package com.xiaoyu.lanling.feature.profile

import androidx.appcompat.app.AlertDialog
import com.xiaoyu.base.app.App
import com.xiaoyu.base.utils.MMKVUtil
import com.xiaoyu.lanling.R
import com.xiaoyu.lanling.common.Constant
import com.xiaoyu.lanling.router.Router

class VerifyDialogManager {

    companion object {

        fun showDialog() {
            App.getInstance().topActivity?.let {
                if (it.isDestroyed) {
                    return@let
                }

                MMKVUtil.get()?.putBoolean(Constant.MMKVKey.KEY_HAS_SHOW_VERIFY_AND_VOICE_DIALOG, true)
                AlertDialog.Builder(it)
                        .setMessage(it.getString(R.string.accost_verify_dialog_title))
                        .setPositiveButton(it.getString(R.string.accost_verify_dialog_positive)) { _, _ -> Router.instance.gotoVerifyHumanActivity(it) }
                        .setCancelable(false)
                        .show()
            }
        }
    }
}